package com.automation.entity;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.nativekey.AndroidKey;
import io.appium.java_client.android.nativekey.KeyEvent;
import org.openqa.selenium.By;

public class DesktopPage extends BasePage {
    private final By dianpingIcon = By.xpath("//android.widget.TextView[@content-desc='大众点评']");

    public DesktopPage(AndroidDriver driver) {
        super(driver);
    }

    public void launchDianping() {
        // 确保返回桌面
        driver.pressKey(new KeyEvent(AndroidKey.HOME));
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {

        }

        // 点击应用图标
        click(dianpingIcon);
    }
}